// 导入封装得网络请求模块
import axios from '@/utils/request'

/**
 *  @description 查询企业的部门列表
 * @returns
 */
export const getDepartments = () => {
  return axios({
    url: '/company/department'
  })
}

/**
* @description: 获取下拉员工数据
* @param {*}
* @return {*}
*/

export function getEmployeeSimple() {
  return axios({
    url: '/sys/user/simple'
  })
}

/**
 * @description 新增部门
 *
*/
export const addDepartments = (data) => {
  return axios({
    url: '/company/department',
    method: 'POST',
    data
  })
}
/**
 * @description: 获取部门详情
 * @param {*} id 表示当前要编辑项的id值
 * @return {*}
 */
export const getDepartDetail = (id) => {
  return axios({
    url: `/company/department/${id}`
  })
}
/**
  * @description: 更新部门数据
  * @param {*} data:form表单数据 但是要有id值
  * @return {*}
  */
export const updateDepartments = (data) => {
  return axios({
    url: `/company/department/${data.id}`,
    method: 'PUT',
    data
  })
}
/**
 * @description 删除部门
 * @param {*} id 部门ID
 * @returns
 */

export const delDepartment = (id) => {
  return axios({
    url: `/company/department/${id}`,
    method: 'DELETE'
  })
}
